/* SolarSeekApplication */

#import <Cocoa/Cocoa.h>

#import "FSourceListView.h"
#import "SolarSeekEngine.h";
#import "SourceListElement.h"
@class SearchesView;
@class PreferencesController;
@class TransferView;
@class ChatsView;
@class FriendsView;

@interface NSView (ParticipantsSelected)
- (NSArray *)participantsSelected;
@end

extern int LogTypeNone; 
extern int LogTypeAll;
extern int LogTypeLoud; 
extern int	LogTypeError; 
extern int	LogTypeServer; 
extern int	LogTypePeer;
extern int	LogTypeLoad;
extern int	LogTypeSearch;
extern int	LogTypeTransfer;
extern int  LogTypeShare;


@interface SolarSeekApplication : NSApplication
{
	BOOL finishedLaunching;
	
	SolarSeekEngine *_engine;
	
	SourceListElement *_elementCurrent;
	
	
	NSMutableAttributedString *_serverMessages;
	
	NSToolbar *_toolbar;
	
	IBOutlet NSArrayController *nibControllerShares;
	IBOutlet NSMenuItem *nibMenuLogIn;
	IBOutlet NSMenuItem *nibMenuAway;
	IBOutlet PreferencesController *nibPreferencesController;

	IBOutlet FSourceListView *nibSourceList;
	IBOutlet FSourceListView *nibSourceListStatic;

	IBOutlet NSTableView *nibTableResults;
	IBOutlet NSTextView *nibTextLog;

	IBOutlet NSView			*nibViewBrowse;
	IBOutlet NSView			*nibViewChat;
	IBOutlet ChatsView		*nibViewChatRooms;
	IBOutlet ChatsView		*nibViewChats;
	IBOutlet TransferView	*nibViewDownloads;
	IBOutlet FriendsView	*nibViewFriends;
	IBOutlet NSView			*nibViewNetwork;
	IBOutlet NSView			*nibViewPrivateChat;
	IBOutlet SearchesView	*nibViewSearches;
	IBOutlet NSView			*nibViewSearchResults;
	IBOutlet NSView			*nibViewSource;
	IBOutlet NSView			*nibViewToolbarSearch;
	IBOutlet TransferView	*nibViewUploads;
	IBOutlet NSView			*nibViewWishlists;
	
	IBOutlet NSWindow *nibWindowMain;
	IBOutlet NSWindow *nibWindowPreferences;
}

- (BOOL)finishedLaunching;

- (NSTextStorage *)log;
- (SolarSeekEngine *)network;
- (NSArray *)wishesUnimplemented;

- (SolarSeekEngine *)engine;
- (NSView *)viewBrowse;
- (NSView *)viewChat;
- (NSView *)viewChatRooms;
- (NSView *)viewChats;
- (NSView *)viewFriends;
- (NSView *)viewNetwork;
- (NSView *)viewPrivateChat;
- (NSView *)viewSearches;
- (NSView *)viewSearchResults;
- (NSView *)viewWishlists;

- (void)appendLogWithHeader:(NSString *)header HTML:(NSString *)html type:(LogType)type;
- (void)appendLogWithHTML:(NSString *)html type:(LogType)type;
- (IBAction)downloadShares:(id)sender;
- (IBAction)logInToServer:(id)sender;
- (IBAction)toggleAway:(id)sender;
- (IBAction)infoWindowForSelectedPeers:(id)sender;
- (void)getInfoWindowForPeer:(Peer *)peer;
- (IBAction)getBuddyIconForSelectedPeers:(id)sender;

- (void)revealDownloadFolder:(id)sender;
- (void)revealIncomingDownloadFolder:(id)sender;
- (void)revealString:(NSString *)string;
- (void)revealStrings:(NSArray *)strings;

- (void)updateSourceList;
- (void)updateSourceListElement:(id<SourceListElement>)e;
- (void)updateSourceListElement:(id<SourceListElement>)e children:(BOOL)children;
- (void)expandSourceListElement:(id<SourceListElement>)sourceListElement;
- (void)selectSourceListElement:(id<SourceListElement>)select;

- (id<SourceListElement>)selectedSourceListElement;
- (id<SourceListElement>)sourceListElementForView:(NSView *)view;

- (void)checkForUpdates;

@end
